<template>
  <view>
    <!-- #ifndef MP-ALIPAY -->
    <swiper class="swiper4-card-swiper" :indicator-dots="true" :circular="true" :autoplay="true" interval="5000" duration="500" @change="cardSwiper"
      indicator-color="#8799a3" indicator-active-color="#0081ff">
      <swiper-item v-for="(item, index) in swiperList" :key="index" :class="cardCur == index ? 'cur' : ''">
        <view class="swiper-item">
          <image :src="item.url" mode="aspectFill" v-if="item.type == 'image'"></image>
          <video :src="item.url" autoplay loop muted :show-play-btn="false" :controls="false" objectFit="cover" v-if="item.type == 'video'"></video>
        </view>
      </swiper-item>
    </swiper>
  </view>
  <!-- #endif -->
  </view>
</template>

<script>
export default {
  data() {
    return {
      cardCur: 0,
      swiperList: [
        {
          id: 0,
          type: 'image',
          url: '/static/swiper_list/2.jpg'
        },
        {
          id: 1,
          type: 'image',
          url: '/static/swiper_list/2.jpg'
        },
        {
          id: 2,
          type: 'image',
          url: '/static/swiper_list/2.jpg'
        },
        {
          id: 3,
          type: 'image',
          url: '/static/swiper_list/2.jpg'
        }
      ]
    };
  },

  methods: {
    cardSwiper(e) {
      this.cardCur = e.detail.current;
    }
  }
};
</script>

<style>
/* @import url('./swiper3.css'); */

.swiper4-card-swiper {
  height: 420upx !important;
}

.swiper4-card-swiper swiper-item {
  width: 610upx !important;
  left: 70upx;
  box-sizing: border-box;
  padding: 40upx 0upx 70upx;
  overflow: initial;
}

.swiper4-card-swiper swiper-item .swiper-item {
  width: 100%;
  display: block;
  height: 100%;
  border-radius: 10upx;
  transform: scale(0.9);
  transition: all 0.2s ease-in 0s;
  overflow: hidden;
}

.swiper4-card-swiper swiper-item.cur .swiper-item {
  transform: none;
  transition: all 0.2s ease-in 0s;
}
</style>
